package com.lemon.smartsafety.ui.fragment.safe.data;

import com.ldzs.recyclerlibrary.Mode;
import com.lemon.smartsafety.app.BundleKey;
import com.lemon.smartsafety.app.EventTag;
import com.lemon.smartsafety.entity.safe.company.CompanyBuildingCheckItemFlowVo;
import com.lemon.smartsafety.entity.safe.company.CompanyBuildingCheckItemVo;
import com.lemon.smartsafety.http.service.SafeDataServices;
import com.lemon.smartsafety.ui.adapter.safe.data.BuildingCheckItemFlowAdapter;
import com.lemon.smartsafetynew.ui.fragment.base.BasePullToRefreshFragment;
import com.lemon.smartsafety.utils.common.LoggerHelper;

import java.util.List;

import kale.adapter.LemonRcvAdapter;

/**
 * 检查项目 检查项目流程
 */
public class BuildingCheckItemFlowListFragment extends BasePullToRefreshFragment<CompanyBuildingCheckItemFlowVo, List<CompanyBuildingCheckItemFlowVo>> {
    private LoggerHelper loggerHelper = new LoggerHelper(BuildingCheckItemFlowListFragment.class);

    private String mKeyWord = null;

    /**
     * bundle info
     */
    private CompanyBuildingCheckItemVo mCompanyBuildingCheckItemVo;

    public static BuildingCheckItemFlowListFragment newInstance() {
        return new BuildingCheckItemFlowListFragment();
    }


    @Override
    protected void getBaseArguments() {
        super.getBaseArguments();
        if (getArguments() != null) {
            mCompanyBuildingCheckItemVo = (CompanyBuildingCheckItemVo) getArguments().getSerializable(BundleKey.COMPANY_BUILDING_CHECK_ITEM_VO);
        }

    }

    @Override
    protected void initViews() {
        super.initViews();
        pageSize = Integer.MAX_VALUE;//这样设置一下，就不就有加载更多了
        mPullToRefreshRecyclerView.setRefreshMode(Mode.PULL_FROM_START);

    }


    @Override
    public boolean goRefreshOnCreate() {
        return true;
    }

    @Override
    public LemonRcvAdapter<CompanyBuildingCheckItemFlowVo> getLemonAdapter() {
        return new BuildingCheckItemFlowAdapter(mDataList);
    }

    @Override
    public String getHttpTag() {
        return EventTag.TAG_SAFE_DATA_COLLECTION_BUILDING_CHECK_ITEM_FLOW_LIST;
    }


    @Override
    public void onLoadMore() {

    }


    @Override
    public void onPullRefresh() {
        SafeDataServices.init().getCheckItemFlowList(mCompanyBuildingCheckItemVo.getItemId(),mKeyWord);
    }

}
